﻿/* Author: Achim Schnell */

using AppFx.Tokenization;
using System;

namespace AppFx.Parsing
{
    /// <summary>
    /// Represents a parsed token.
    /// </summary>
    public class ParsedToken : Token, AppFx.Parsing.IParsedToken
    {
        #region Properties

        /// <summary>
        /// Gets the type of the parsed token.
        /// </summary>
        public eParsedTokenType ParsedType { get; set; }

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="ParsedToken"/> class.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <param name="parsedType">Type of the parsed token..</param>
        public ParsedToken(IToken token, eParsedTokenType parsedType) : base(token.Content, token.Type) 
        {
            ParsedType = parsedType;
        }

        #endregion

        #region Methods

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            return base.ToString() + String.Format(" -> {0}", ParsedType);
        }

        #endregion
    }
}
